<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%
	if (session.isNew()) {
	response.sendRedirect("index.jsp");
	return;	
	} 
%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="stylesheet" type="text/css" href="style.css" />
	<title>Admin page</title>
</head>

<body>
<div id="masterContainer">
	
	<div id="headerContainer">
		<img src="../img/shop-logo.jpg"/>
	</div>

	<div id="mainContainer">
		<div id="barContainer">
			<div id="boxContainer">
				<div class='boxContent'>You are logged in as admin user: <strong><%=request.getUserPrincipal().getName()%></strong></div>
				<a href="adminLogout.jsp">Log out and return to frontpage</a>
			</div>
		</div>
		
		<table>
			<tr>
				<td>
				<h3>Edit movie</h3>
				<form action="editMovie" method="post">
				<table>
					<tr>
						<th align="right" width="120">ItemId:</th>
						<td align="left"><input type="text" name="itemID" /></td>
					</tr>
					<tr>
						<th align="right">Name:</th>
						<td align="left"><input type="text" name="itemName" /></td>
					</tr>
					<tr>
						<th align="right">Price:</th>
						<td align="left"><input type="text" name="itemPrice" /></td>
					</tr>
					<tr>
						<th align="right">picture URL:</th>
						<td align="left"><input type="text" name="itemURL" /></td>
					</tr>
					<tr>
						<th align="right">Movie Description</th>
						<td align="left"><input type="text" name="itemDescription" /></td>
					</tr>
					<tr>
						<th align="right">&nbsp;</th>
						<td align="left"><input type="submit" value="Edit movie" /></td>
					</tr>
				</table>
				</form>
				
				<h3>Adjust Stock</h3>
				<form action="adjustStock" method="post">
				<table cellspacing="3">
					<tr>
						<th align="right" width="120">ItemId:</th>
						<td align="left"><input type="text" name="itemID" /></td>
					</tr>
					<tr>
						<th align="right">Stock Adjustment</th>
						<td align="left"><input type="text" name="adjustment" /></td>
					</tr>
					<tr>
						<th align="right">&nbsp;</th>
						<td align="left"><input type="submit" value="Adjust stock" /></td>
					</tr>
				</table>
				</form>
				
				<h3>Create Movie</h3>
				<form action="createMovie" method="post">
				<table cellspacing="2">
					<tr>
						<th align="right" width="120">Item name:</th>
						<td align="left"><input type="text" name="itemName" /></td>
					</tr>
					<tr>
						<th align="right">&nbsp;</th>
						<td align="left"><input type="submit" value="Create movie" /></td>
					</tr>
				</table>
				</form>
				
				</td>
				<td valign="top"><jsp:include page="adminItemServlet"/></td>
			</tr>
		</table>
	</div>
</div>
</body>
</html>
